<#assign tit>租箱归还</#assign>
<@page.html title=tit>
<script type="text/javascript" src="${_appPath!}/js/cal.js"></script>
<script type="text/javascript">
  function chgfact() {
    var fm = getEl("fm_input");
    if(fm.addAmount.value=="") {
      fm.payAmount.value = "";
      return;
    }
    var m1 = parseFloat(fm.addAmount.value);
    if(isNaN(m1)) {
      window.alert("金额错误");
      return;
    }
    var m3 = 0;
    if(fm.depositAmount.value!="") m3 = parseFloat(fm.depositAmount.value);
    fm.addAmount.value = formatMoney(m1);
    fm.payAmount.value = formatMoney(m1-m3);
  }

  function chgpaym() {
    var fm = getEl("fm_input");
    if(fm.payAmount.value=="") {
      fm.addAmount.value = "";
      return;
    }
    var m1 = parseFloat(fm.payAmount.value);
    if(isNaN(m1)) {
      window.alert("金额错误");
      return;
    }
    var m3 = 0;
    if(fm.depositAmount.value!="") m3 = parseFloat(fm.depositAmount.value);
    fm.addAmount.value = formatMoney(m1+m3);
    fm.payAmount.value = formatMoney(m1);
  }

  function save(fm) {
    if(!fm) fm = getEl("fm_input");
    var mm = fm.payAmount.value;
    post(fm, function(){
      openWin("getPay?money="+mm, 500, 400);
      return false;
    });
    return false;
  }
  function payOk(vv) {
    var fm = getEl("fm_input");
    fm.payls.value = vv;
    postForm(fm.action, fm, saveRet);
  }
  function saveRet(data) {
    window.alert(data.msg);
    if(data.ret) cload();
  }
</script>
<div style="width:600px;">

  <form id="fm_input" method="post" action="_retur" onsubmit="return save(this);">
    <input type="hidden" name="payls" value="">
    <div class="kbox">
      <table class="input w4">
        <tr>
          <th width="85">会员卡号</th>
          <td width="160"><input type="text" name="cardCode" value="${member.cardCode!}" maxlength="20" class="disable" readonly></td>
          <th width="85"></th>
          <td width="160"><!--label><input type="checkbox" class="cb" name="signStatus" value="0">不使用手写签名</label--></td>
        </tr>
        <tr>
          <th>会员姓名</th>
          <td><input type="text" name="memberName" value="${member.chName!}" class="disable" readonly></td>
          <th>会员编号</th>
          <td><input type="text" name="memberCode" value="${member.memberCode!}" class="disable" readonly></td>
        </tr>

        <tr>
          <th>租箱号</th>
          <td><input type="text" name="boxCode" value="${box.code!}" class="disable" readonly></td>
          <th></th>
          <td></td>
        </tr>
        <tr>
          <th>开始日期</th>
          <td><input type="text" name="beginTime" value="${rent.beginTime!}" class="date disable" maxlength="10" readonly></td>
          <th>结束日期</th>
          <td><input type="text" name="endTime" value="${rent.endTime!}" class="date disable" maxlength="10" readonly></td>
        </tr>
        <tr>
          <th>已收租金</th>
          <td><input type="text" name="factAmount" value="${rent.factAmount?string("0.00")}" class="disable" readonly></td>
          <th>补收租金</th>
          <td><input type="text" name="addAmount" value="" onchange="chgfact();" req="补收租金"></td>
        </tr>
        <tr>
          <th>退还押金</th>
          <td><input type="text" name="depositAmount" value="${rent.depositAmount?string("0.00")}" class="disable" readonly></td>
          <th>应收金额</th>
          <td><input type="text" name="payAmount" value="" onchange="chgpaym();" req="应收金额"></td>
        </tr>
      </table>
    </div>
    <div class="button"><input type="button" value="确认并提交" onclick="save();"></div>
  </form>
</div>

</@page.html>